#n plates fro A to C via B
ans = 0
def Move(n, A, B, C):
    if n == 0:
        return
    Move(n-1, A, C, B)
    global ans
    ans += 1
    print("{} -> {}".format(A, C), ans)
    Move(n-1, B, A, C)

Move(30, 'A', 'B', 'C')
print(ans)